package com.info.dpunified.dpgen.service;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.info.dpunified.common.exception.DPUnifiedException;
import com.info.dpunified.dpgen.dataaccess.UserManagementDAO;
import com.info.dpunified.web.model.UserProfile;

public class UserManagementService {
	
	protected final Log logger = LogFactory.getLog(getClass());
	
	private UserManagementDAO userManagementDAO;
	
	
	/**
	 * @return the userManagementDAO
	 */
	public UserManagementDAO getUserManagementDAO() {
		return userManagementDAO;
	}


	/**
	 * @param userManagementDAO the userManagementDAO to set
	 */
	public void setUserManagementDAO(UserManagementDAO userManagementDAO) {
		this.userManagementDAO = userManagementDAO;
	}


	public boolean login(String username, String password) throws DPUnifiedException
	{
		logger.info("login credentials check begins..");
		boolean loginSuccess = true;
		UserProfile userProfile = new UserProfile();
		userProfile.setUsername(username);
		userProfile.setPassword(password);
		loginSuccess = this.getUserManagementDAO().login(userProfile);
		logger.info("login credentials check result >>"+loginSuccess);
		return loginSuccess;
	}

}
